package com.augurit.common.system.convert;

import java.util.ArrayList;
import java.util.List;

import com.augurit.common.entity.OmUserGroup;
import com.augurit.common.system.web.org.form.OmUserGroupForm;

public class OmUserGroupConverter {
	public static OmUserGroupForm convertToForm(OmUserGroup entity){
		if(entity != null){
			OmUserGroupForm form = new OmUserGroupForm();

			form.setUgId(entity.getUgId());
			form.setGroupId(entity.getGroupId());
			form.setUserId(entity.getUserId());
			return form;
		}else
			return null;
	}
	
	public static List<OmUserGroupForm> convertToForm(List<Object[]> list){
		if(list != null && list.size() > 0){
			List<OmUserGroupForm> result = new ArrayList();
			
			for(Object[] objs : list){
				OmUserGroupForm form = convertToForm((OmUserGroup)objs[0]);
				form.setGroupName((String)objs[1]);
				result.add(form);
			}
			
			return result;
		}else
			return null;
	}
}
